#include<stdio.h>
#include<vector>
#include<string>
using namespace std;
class TheSimpleGame
{
public:
    int count(int n, vector <int> x, vector <int> y)
    {
    	int i;
    	int sum=0;
    	int size = x.size();
    	for(i=0;i<size;i++)
    	{
    		if(x[i]<=n/2)
    			sum += x[i]-1;
    		else
    			sum += n-x[i];
    		if(y[i]<=n/2)
    			sum += y[i]-1;
    		else
    			sum += n-y[i];
    	}
    	return sum;
    }
};
